import React,{useContext as Context} from 'react'

import { ColorContext ,UPDATE_COLOR} from './Color';

function Buttons(){
    const {dispatch} = Context(ColorContext)
    return (
        <div>
            <button onClick={()=>{dispatch({type:UPDATE_COLOR,color:"red"})}}>红色</button>
            <button onClick={()=>{dispatch({type:UPDATE_COLOR,color:"yellow"})}}>黄色</button>
        </div>
    )
}

export default Buttons